package com.lbd.system.service.impl;

import com.lbd.base.service.BaseServiceImpl;
import com.lbd.system.bean.UserMoneyStatistics;
import com.lbd.system.dao.UserMoneyStatisticsRepository;
import com.lbd.system.service.UserMoneyStatisticsService;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.Map;

/**
 * Created by zzl on 2016/10/31.
 */
@Service
@Transactional
public class UserMoneyStatisticsServiceImpl extends BaseServiceImpl<UserMoneyStatistics, UserMoneyStatisticsRepository> implements UserMoneyStatisticsService {
    private final Logger log = Logger.getLogger(this.getClass());
    @Resource
    UserMoneyStatisticsRepository userMoneyStatisticsRepository;

    @Override
    public String buildJpql(UserMoneyStatistics userMoneyStatistics, Map<String, Object> parameter) {
        StringBuilder jpqlBuilder = new StringBuilder(" from  UserMoneyStatistics t ");
        if (userMoneyStatistics != null) {

        }
        jpqlBuilder.append(" order by createdDate desc");
        return jpqlBuilder.toString();
    }

    /**
     * 通过用户Id查询用户资金统计信息
     *
     * @param userId
     * @return
     */
    @Override
    public UserMoneyStatistics findByUserId(String userId) {
        return userMoneyStatisticsRepository.findByUserId(userId);
    }
}
